# -*- encoding: utf-8 -*-
info = {'name':'班长','id':100,'sex':'f','address':'地球亚洲中国北京'}
print(info['name'])
print(info['address'])
#print(info['age'])   #没有则报错
age = info.get('age',18)   #添加到字典中
print(age)


#增删改查
#1.修改
'''newID = input('请输入新的学号')
info['id'] = int(newID)
print('修改之后的id为%d'%info['id'])
'''
#2.添加
'''info1 = {'name':'班长','sex':'f','address':'地球亚洲中国北京'}
#print('id为：%d'%info1['id'])  #报错
new_id = input('请输入新的学号')
info1['id'] = int(new_id)
print('添加之后的id：%d'%info1['id'])
print('id为：%d'%info1['id'])'''

#3.删除
info1 = {'name':'班长','sex':'f','address':'地球亚洲中国北京'}
print("删除之前,%s"%info1['name'])
del info1['name']
# print("删除之后,%s"%info1['name'])
print(info1)


print("清空之前",info)
info.clear()
print("清空之后",info)
